package COMP;

import java.io.FileWriter;
import java.io.IOException;

import au.com.bytecode.opencsv.CSVWriter;

public class ExportCsv {
	private String filepath;

	public ExportCsv() {

	}

	public void setFilePath(String filepath) {
		String new_file_name = filepath.substring(0, filepath.indexOf(".xls"))
				+ ".csv";
		this.filepath = new_file_name;
	}

	public void Start(String[][] temp) {
		try {
			CSVWriter csvOutput = new CSVWriter(new FileWriter(filepath));

			if(temp != null){
				for (int i = 0; i < temp.length; i++) {
					csvOutput.writeNext(temp[i]);
				}
			}

			csvOutput.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
